home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / AEObjects.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  15.5 KB  |  345 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AEObjects.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __AEOBJECTS__
  18. #define __AEOBJECTS__
  19.  
  20.  
  21. #ifndef __MEMORY__
  22. #include <Memory.h>
  23. #endif
  24. /*    #include <Types.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <MixedMode.h>                                        */
  27.  
  28. #ifndef __OSUTILS__
  29. #include <OSUtils.h>
  30. #endif
  31.  
  32. #ifndef __QUICKDRAW__
  33. #include <Quickdraw.h>
  34. #endif
  35. /*    #include <QuickdrawText.h>                                    */
  36.  
  37. #ifndef __EVENTS__
  38. #include <Events.h>
  39. #endif
  40.  
  41. #ifndef __EPPC__
  42. #include <EPPC.h>
  43. #endif
  44. /*    #include <Errors.h>                                            */
  45. /*    #include <PPCToolbox.h>                                        */
  46. /*        #include <AppleTalk.h>                                    */
  47. /*    #include <Processes.h>                                        */
  48. /*        #include <Files.h>                                        */
  49.  
  50. #ifndef __APPLEEVENTS__
  51. #include <AppleEvents.h>
  52. #endif
  53. /*    #include <Notification.h>                                    */
  54.  
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58.  
  59. #if GENERATINGPOWERPC
  60. #pragma options align=mac68k
  61. #endif
  62.  
  63. #ifdef __CFM68K__
  64. #pragma lib_export on
  65. #endif
  66.  
  67.  
  68. enum {
  69.     kAEAND                        = 'AND ',                        /*  0x414e4420  */
  70.     kAEOR                        = 'OR  ',                        /*  0x4f522020  */
  71.     kAENOT                        = 'NOT ',                        /*  0x4e4f5420  */
  72. /****    ABSOLUTE ORDINAL CONSTANTS    ****/
  73.     kAEFirst                    = 'firs',                        /*  0x66697273  */
  74.     kAELast                        = 'last',                        /*  0x6c617374  */
  75.     kAEMiddle                    = 'midd',                        /*  0x6d696464  */
  76.     kAEAny                        = 'any ',                        /*  0x616e7920  */
  77.     kAEAll                        = 'all ',                        /*  0x616c6c20  */
  78. /****    RELATIVE ORDINAL CONSTANTS    ****/
  79.     kAENext                        = 'next',                        /*  0x6e657874  */
  80.     kAEPrevious                    = 'prev',                        /*  0x70726576  */
  81. /****    KEYWORD CONSTANT     ****/
  82.     keyAECompOperator            = 'relo',                        /*  0x72656c6f  */
  83.     keyAELogicalTerms            = 'term',                        /*  0x7465726d  */
  84.     keyAELogicalOperator        = 'logc',                        /*  0x6c6f6763  */
  85.     keyAEObject1                = 'obj1',                        /*  0x6f626a31  */
  86.     keyAEObject2                = 'obj2',                        /*  0x6f626a32  */
  87. /*    ... for Keywords for getting fields out of object specifier records. */
  88.     keyAEDesiredClass            = 'want',                        /*  0x77616e74  */
  89.     keyAEContainer                = 'from',                        /*  0x66726f6d  */
  90.     keyAEKeyForm                = 'form',                        /*  0x666f726d  */
  91.     keyAEKeyData                = 'seld'
  92. };
  93.  
  94. enum {
  95. /*    ... for Keywords for getting fields out of Range specifier records. */
  96.     keyAERangeStart                = 'star',                        /*  0x73746172  */
  97.     keyAERangeStop                = 'stop',                        /*  0x73746f70  */
  98. /*    ... special handler selectors for OSL Callbacks. */
  99.     keyDisposeTokenProc            = 'xtok',                        /*  0x78746f6b  */
  100.     keyAECompareProc            = 'cmpr',                        /*  0x636d7072  */
  101.     keyAECountProc                = 'cont',                        /*  0x636f6e74  */
  102.     keyAEMarkTokenProc            = 'mkid',                        /*  0x6d6b6964  */
  103.     keyAEMarkProc                = 'mark',                        /*  0x6d61726b  */
  104.     keyAEAdjustMarksProc        = 'adjm',                        /*  0x61646a6d  */
  105.     keyAEGetErrDescProc            = 'indc'
  106. };
  107.  
  108. /****    VALUE and TYPE CONSTANTS    ****/
  109. enum {
  110. /*    ... possible values for the keyAEKeyForm field of an object specifier. */
  111.     formAbsolutePosition        = 'indx',                        /*  0x696e6478  */
  112.     formRelativePosition        = 'rele',                        /*  0x72656c65  */
  113.     formTest                    = 'test',                        /*  0x74657374  */
  114.     formRange                    = 'rang',                        /*  0x72616e67  */
  115.     formPropertyID                = 'prop',                        /*  0x70726f70  */
  116.     formName                    = 'name',                        /*  0x6e616d65  */
  117. /*    ... relevant types (some of these are often pared with forms above). */
  118.     typeObjectSpecifier            = 'obj ',                        /*  0x6f626a20  */
  119.     typeObjectBeingExamined        = 'exmn',                        /*  0x65786d6e  */
  120.     typeCurrentContainer        = 'ccnt',                        /*  0x63636e74  */
  121.     typeToken                    = 'toke',                        /*  0x746f6b65  */
  122.     typeRelativeDescriptor        = 'rel ',                        /*  0x72656c20  */
  123.     typeAbsoluteOrdinal            = 'abso',                        /*  0x6162736f  */
  124.     typeIndexDescriptor            = 'inde',                        /*  0x696e6465  */
  125.     typeRangeDescriptor            = 'rang',                        /*  0x72616e67  */
  126.     typeLogicalDescriptor        = 'logi',                        /*  0x6c6f6769  */
  127.     typeCompDescriptor            = 'cmpd'
  128. };
  129.  
  130. /* Possible values for flags parameter to AEResolve.  They're additive */
  131. enum {
  132.     kAEIDoMinimum                = 0x0000,
  133.     kAEIDoWhose                    = 0x0001,
  134.     kAEIDoMarking                = 0x0004
  135. };
  136.  
  137. /**** SPECIAL CONSTANTS FOR CUSTOM WHOSE-CLAUSE RESOLUTION */
  138. enum {
  139.     typeWhoseDescriptor            = 'whos',                        /*  0x77686f73  */
  140.     formWhose                    = 'whos',                        /*  0x77686f73  */
  141.     typeWhoseRange                = 'wrng',                        /*  0x77726e67  */
  142.     keyAEWhoseRangeStart        = 'wstr',                        /*  0x77737472  */
  143.     keyAEWhoseRangeStop            = 'wstp',                        /*  0x77737470  */
  144.     keyAEIndex                    = 'kidx',                        /*  0x6b696478  */
  145.     keyAETest                    = 'ktst'
  146. };
  147.  
  148. /**
  149.     used for rewriting tokens in place of 'ccnt' descriptors
  150.     This record is only of interest to those who, when they...
  151.     ...get ranges as key data in their accessor procs, choose
  152.     ...to resolve them manually rather than call AEResolve again.
  153. **/
  154. struct ccntTokenRecord {
  155.     DescType                        tokenClass;
  156.     AEDesc                            token;
  157. };
  158. typedef struct ccntTokenRecord ccntTokenRecord, *ccntTokenRecPtr, **ccntTokenRecHandle;
  159.  
  160. typedef AEDesc *DescPtr, **DescHandle;
  161.  
  162. /* typedefs providing type checking for procedure pointers */
  163. typedef pascal OSErr (*OSLAccessorProcPtr)(DescType desiredClass, const AEDesc *container, DescType containerClass, DescType form, const AEDesc *selectionData, AEDesc *value, long accessorRefcon);
  164. typedef pascal OSErr (*OSLCompareProcPtr)(DescType oper, const AEDesc *obj1, const AEDesc *obj2, Boolean *result);
  165. typedef pascal OSErr (*OSLCountProcPtr)(DescType desiredType, DescType containerClass, const AEDesc *container, long *result);
  166. typedef pascal OSErr (*OSLDisposeTokenProcPtr)(AEDesc *unneededToken);
  167. typedef pascal OSErr (*OSLGetMarkTokenProcPtr)(const AEDesc *dContainerToken, DescType containerClass, AEDesc *result);
  168. typedef pascal OSErr (*OSLGetErrDescProcPtr)(DescPtr *appDescPtr);
  169. typedef pascal OSErr (*OSLMarkProcPtr)(const AEDesc *dToken, const AEDesc *markToken, long index);
  170. typedef pascal OSErr (*OSLAdjustMarksProcPtr)(long newStart, long newStop, const AEDesc *markToken);
  171.  
  172. #if GENERATINGCFM
  173. typedef UniversalProcPtr OSLAccessorUPP;
  174. typedef UniversalProcPtr OSLCompareUPP;
  175. typedef UniversalProcPtr OSLCountUPP;
  176. typedef UniversalProcPtr OSLDisposeTokenUPP;
  177. typedef UniversalProcPtr OSLGetMarkTokenUPP;
  178. typedef UniversalProcPtr OSLGetErrDescUPP;
  179. typedef UniversalProcPtr OSLMarkUPP;
  180. typedef UniversalProcPtr OSLAdjustMarksUPP;
  181. #else
  182. typedef OSLAccessorProcPtr OSLAccessorUPP;
  183. typedef OSLCompareProcPtr OSLCompareUPP;
  184. typedef OSLCountProcPtr OSLCountUPP;
  185. typedef OSLDisposeTokenProcPtr OSLDisposeTokenUPP;
  186. typedef OSLGetMarkTokenProcPtr OSLGetMarkTokenUPP;
  187. typedef OSLGetErrDescProcPtr OSLGetErrDescUPP;
  188. typedef OSLMarkProcPtr OSLMarkUPP;
  189. typedef OSLAdjustMarksProcPtr OSLAdjustMarksUPP;
  190. #endif
  191.  
  192. enum {
  193.     uppOSLAccessorProcInfo = kPascalStackBased
  194.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  195.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  196.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  197.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DescType)))
  198.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(DescType)))
  199.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AEDesc*)))
  200.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEDesc*)))
  201.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(long))),
  202.     uppOSLCompareProcInfo = kPascalStackBased
  203.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  204.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  205.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  206.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  207.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Boolean*))),
  208.     uppOSLCountProcInfo = kPascalStackBased
  209.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  210.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  211.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  212.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  213.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long*))),
  214.     uppOSLDisposeTokenProcInfo = kPascalStackBased
  215.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  216.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*))),
  217.     uppOSLGetMarkTokenProcInfo = kPascalStackBased
  218.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  219.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  220.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  221.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*))),
  222.     uppOSLGetErrDescProcInfo = kPascalStackBased
  223.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  224.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescPtr*))),
  225.     uppOSLMarkProcInfo = kPascalStackBased
  226.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  227.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  228.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  229.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  230.     uppOSLAdjustMarksProcInfo = kPascalStackBased
  231.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  232.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  233.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  234.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  235. };
  236.  
  237. #if GENERATINGCFM
  238. #define NewOSLAccessorProc(userRoutine)        \
  239.         (OSLAccessorUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLAccessorProcInfo, GetCurrentArchitecture())
  240. #define NewOSLCompareProc(userRoutine)        \
  241.         (OSLCompareUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLCompareProcInfo, GetCurrentArchitecture())
  242. #define NewOSLCountProc(userRoutine)        \
  243.         (OSLCountUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLCountProcInfo, GetCurrentArchitecture())
  244. #define NewOSLDisposeTokenProc(userRoutine)        \
  245.         (OSLDisposeTokenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLDisposeTokenProcInfo, GetCurrentArchitecture())
  246. #define NewOSLGetMarkTokenProc(userRoutine)        \
  247.         (OSLGetMarkTokenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLGetMarkTokenProcInfo, GetCurrentArchitecture())
  248. #define NewOSLGetErrDescProc(userRoutine)        \
  249.         (OSLGetErrDescUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLGetErrDescProcInfo, GetCurrentArchitecture())
  250. #define NewOSLMarkProc(userRoutine)        \
  251.         (OSLMarkUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLMarkProcInfo, GetCurrentArchitecture())
  252. #define NewOSLAdjustMarksProc(userRoutine)        \
  253.         (OSLAdjustMarksUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLAdjustMarksProcInfo, GetCurrentArchitecture())
  254. #else
  255. #define NewOSLAccessorProc(userRoutine)        \
  256.         ((OSLAccessorUPP) (userRoutine))
  257. #define NewOSLCompareProc(userRoutine)        \
  258.         ((OSLCompareUPP) (userRoutine))
  259. #define NewOSLCountProc(userRoutine)        \
  260.         ((OSLCountUPP) (userRoutine))
  261. #define NewOSLDisposeTokenProc(userRoutine)        \
  262.         ((OSLDisposeTokenUPP) (userRoutine))
  263. #define NewOSLGetMarkTokenProc(userRoutine)        \
  264.         ((OSLGetMarkTokenUPP) (userRoutine))
  265. #define NewOSLGetErrDescProc(userRoutine)        \
  266.         ((OSLGetErrDescUPP) (userRoutine))
  267. #define NewOSLMarkProc(userRoutine)        \
  268.         ((OSLMarkUPP) (userRoutine))
  269. #define NewOSLAdjustMarksProc(userRoutine)        \
  270.         ((OSLAdjustMarksUPP) (userRoutine))
  271. #endif
  272.  
  273. #if GENERATINGCFM
  274. #define CallOSLAccessorProc(userRoutine, desiredClass, container, containerClass, form, selectionData, value, accessorRefcon)        \
  275.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLAccessorProcInfo, (desiredClass), (container), (containerClass), (form), (selectionData), (value), (accessorRefcon))
  276. #define CallOSLCompareProc(userRoutine, oper, obj1, obj2, result)        \
  277.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLCompareProcInfo, (oper), (obj1), (obj2), (result))
  278. #define CallOSLCountProc(userRoutine, desiredType, containerClass, container, result)        \
  279.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLCountProcInfo, (desiredType), (containerClass), (container), (result))
  280. #define CallOSLDisposeTokenProc(userRoutine, unneededToken)        \
  281.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLDisposeTokenProcInfo, (unneededToken))
  282. #define CallOSLGetMarkTokenProc(userRoutine, dContainerToken, containerClass, result)        \
  283.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLGetMarkTokenProcInfo, (dContainerToken), (containerClass), (result))
  284. #define CallOSLGetErrDescProc(userRoutine, appDescPtr)        \
  285.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLGetErrDescProcInfo, (appDescPtr))
  286. #define CallOSLMarkProc(userRoutine, dToken, markToken, index)        \
  287.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLMarkProcInfo, (dToken), (markToken), (index))
  288. #define CallOSLAdjustMarksProc(userRoutine, newStart, newStop, markToken)        \
  289.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLAdjustMarksProcInfo, (newStart), (newStop), (markToken))
  290. #else
  291. #define CallOSLAccessorProc(userRoutine, desiredClass, container, containerClass, form, selectionData, value, accessorRefcon)        \
  292.         (*(userRoutine))((desiredClass), (container), (containerClass), (form), (selectionData), (value), (accessorRefcon))
  293. #define CallOSLCompareProc(userRoutine, oper, obj1, obj2, result)        \
  294.         (*(userRoutine))((oper), (obj1), (obj2), (result))
  295. #define CallOSLCountProc(userRoutine, desiredType, containerClass, container, result)        \
  296.         (*(userRoutine))((desiredType), (containerClass), (container), (result))
  297. #define CallOSLDisposeTokenProc(userRoutine, unneededToken)        \
  298.         (*(userRoutine))((unneededToken))
  299. #define CallOSLGetMarkTokenProc(userRoutine, dContainerToken, containerClass, result)        \
  300.         (*(userRoutine))((dContainerToken), (containerClass), (result))
  301. #define CallOSLGetErrDescProc(userRoutine, appDescPtr)        \
  302.         (*(userRoutine))((appDescPtr))
  303. #define CallOSLMarkProc(userRoutine, dToken, markToken, index)        \
  304.         (*(userRoutine))((dToken), (markToken), (index))
  305. #define CallOSLAdjustMarksProc(userRoutine, newStart, newStop, markToken)        \
  306.         (*(userRoutine))((newStart), (newStop), (markToken))
  307. #endif
  308.  
  309. extern pascal OSErr AEObjectInit(void);
  310. /* Not done by inline, but by direct linking into code.  It sets up the pack
  311.   such that further calls can be via inline */
  312. extern pascal OSErr AESetObjectCallbacks(OSLCompareUPP myCompareProc, OSLCountUPP myCountProc, OSLDisposeTokenUPP myDisposeTokenProc, OSLGetMarkTokenUPP myGetMarkTokenProc, OSLMarkUPP myMarkProc, OSLAdjustMarksUPP myAdjustMarksProc, OSLGetErrDescUPP myGetErrDescProcPtr)
  313.  THREEWORDINLINE(0x303C, 0x0E35, 0xA816);
  314. extern pascal OSErr AEResolve(const AEDesc *objectSpecifier, short callbackFlags, AEDesc *theToken)
  315.  THREEWORDINLINE(0x303C, 0x0536, 0xA816);
  316. extern pascal OSErr AEInstallObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP theAccessor, long accessorRefcon, Boolean isSysHandler)
  317.  THREEWORDINLINE(0x303C, 0x0937, 0xA816);
  318. extern pascal OSErr AERemoveObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP theAccessor, Boolean isSysHandler)
  319.  THREEWORDINLINE(0x303C, 0x0738, 0xA816);
  320. extern pascal OSErr AEGetObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP *accessor, long *accessorRefcon, Boolean isSysHandler)
  321.  THREEWORDINLINE(0x303C, 0x0939, 0xA816);
  322. extern pascal OSErr AEDisposeToken(AEDesc *theToken)
  323.  THREEWORDINLINE(0x303C, 0x023A, 0xA816);
  324. extern pascal OSErr AECallObjectAccessor(DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *token)
  325.  THREEWORDINLINE(0x303C, 0x0C3B, 0xA816);
  326. /*——————————————————————————————— END PUBLIC PROCEDURES ——————————————————————————-—*/
  327. /*——————————————————————————————————————————————————————————————-------------------—*/
  328. /*  NOTE: To check for the presence of the Object Support Library on PowerPC, use    */
  329. /*    the Gestalt selector, gestaltOSLInSystem, which is defined in Gestalt.h/p/a.    */
  330. /*——————————————————————————————————————————————————————————————-------------------—*/
  331.  
  332. #ifdef __CFM68K__
  333. #pragma lib_export off
  334. #endif
  335.  
  336. #if GENERATINGPOWERPC
  337. #pragma options align=reset
  338. #endif
  339.  
  340. #ifdef __cplusplus
  341. }
  342. #endif
  343.  
  344. #endif /* __AEOBJECTS__ */
  345.